<?php
include("./include/config.inc.php");
if(!isset($_SESSION['s_activId']))
{
  header("Location:checkLogin.php");
}
if(isset($_POST['submitBtn']) && strlen($_POST['editor']) != '')
{
	echo $insert = "INSERT INTO contain (menuId,editor) 
	                 VALUE (".$_POST['menuId'].",'".$_POST['editor']."')";
  $insertRes = mysql_query($insert);
  if(!$insertRes)
  {
  	die ("Insert Query Not Insertd :" .mysql_error());
  }
  else
  {
  	header("Location:index.php");
  }
}
$menuArray = array();
$i = 0;
$selectMenu = "SELECT menuId,menuName
                 FROM menu";
$selectMenuRes = mysql_query($selectMenu);
while($menuRow = mysql_fetch_array($selectMenuRes))
{
  $menuArray['menuId'][$i]   = $menuRow['menuId'];
  $menuArray['menuName'][$i] = $menuRow['menuName'];
  $i++;
}
include("./bottom.php");
$smarty->assign("menuArray",$menuArray);
$smarty->display("index.tpl");
?>